#!/usr/bin/python3
# -*- encoding: utf-8 -*-
'''
@File        :requests请求.py
@Time        :2020/09/06 22:52:30
@Author      :He
@Software    :vsCode
'''

from requests import get
import random

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4238.0 Safari/537.36'
}


url = "http://www.baidu.com/"
# 发送请求
resp = get(url, headers=headers)
# 打印请求状态    200代表成功
print(resp.status_code)
# 接收内容
if resp.status_code == 200:
    info = resp.text
